Data from get_nlcd()

Data source: https://www.mrlc.gov/

Data was retrieved using the FedData library, get_nlcd function. The function returns a RasterLayer of NLCD data cropped to a given template study area. In this project, we pulled the impervious surfaces and tree canopy data to then analyze based on different tracts, blocks in various locations around Virginia.

library(tidyverse)
library(leaflet)
library(sp)
library(viridis)
library(raster)

Tree Canopy

Charlottesville Region

cville_tracts <- readRDS("Cville_Tree/cville_tracts.RDS")
cville_blkgps <- readRDS("Cville_Tree/cville_blkgps.RDS")
cville_blocks <- readRDS("Cville_Tree/cville_blocks.RDS")

Tracts

cvl_tracts <- read.csv("Cville_Tree/nlcd_tree_cville_tracts.csv")

head(cvl_tracts)
##   STATEFP COUNTYFP TRACTCE       GEOID    NAME             NAMELSAD INTPTLAT
## 1      51      109  950202 51109950202 9502.02 Census Tract 9502.02 38.03838
## 2      51      109  950300 51109950300 9503.00    Census Tract 9503 38.06236
## 3      51       79   30200 51079030200  302.00     Census Tract 302 38.23058
## 4      51       79   30102 51079030102  301.02  Census Tract 301.02 38.27618
## 5      51        3   11303 51003011303  113.03  Census Tract 113.03 38.00325
## 6      51        3   11201 51003011201  112.01  Census Tract 112.01 38.00351
##    INTPTLON tree_can
## 1 -77.90236 59.46266
## 2 -78.14081 56.50907
## 3 -78.38839 47.86960
## 4 -78.52797 69.19865
## 5 -78.48798 48.20600
## 6 -78.74563 72.63061
# cvl_tracts <- cvl_tracts[complete.cases(cvl_tracts),]


cville_tracts$tree_can <- cvl_tracts$tree_can


pal <- colorNumeric("plasma", reverse = TRUE, domain = cvl_tracts$tree_can)
cvl_tracts$tree_can <- as.numeric(cvl_tracts$tree_can)
cville_tracts$COUNTYFP <- as.numeric(cville_tracts$COUNTYFP)
m <- leaflet()%>%
  addTiles()%>%
  addPolygons(data = cville_tracts,
              fillColor = ~pal(tree_can),
              weight = 1,
              opacity = 1,
              color = "white",
              fillOpacity = 0.6,
              highlight = highlightOptions(weight = 2, fillOpacity = 0.8, bringToFront = T),
              popup = paste0("FIPS Code: ", cvl_tracts$GEOID, "<br>",
                             "Tree Canopy: ", cvl_tracts$tree_can)) %>%
  addLegend("bottomright", pal = pal, values = cvl_tracts$tree_can,
            title = "Tree Canopy", opacity = 0.7)
m

Blockgroups

cvl_blkgps <- read.csv("Cville_Tree/nlcd_tree_cville_blkgps.csv")%>%
  as.data.frame()
head(cvl_blkgps)
##   STATEFP COUNTYFP TRACTCE BLKGRPCE     GEOID      NAMELSAD  tree_can
## 1      51      540     502        2 5.154e+11 Block Group 2 58.957265
## 2      51      540     502        3 5.154e+11 Block Group 3 71.688608
## 3      51      540     502        4 5.154e+11 Block Group 4 65.464991
## 4      51      540     502        5 5.154e+11 Block Group 5 44.585911
## 5      51      540     600        1 5.154e+11 Block Group 1 28.384220
## 6      51      540     202        2 5.154e+11 Block Group 2  9.651163
cville_blkgps$tree_can <- cvl_blkgps$tree_can

pal <- colorNumeric("plasma", reverse = TRUE, domain = cvl_blkgps$tree_can)
cvl_blkgps$tree_can <- as.numeric(cvl_blkgps$tree_can)
cville_blkgps$COUNTYFP <- as.numeric(cville_blkgps$COUNTYFP)
m <- leaflet()%>%
  addTiles()%>%
  addPolygons(data = cville_blkgps,
              fillColor = ~pal(tree_can),
              weight = 1,
              opacity = 1,
              color = "white",
              fillOpacity = 0.6,
              highlight = highlightOptions(weight = 2, fillOpacity = 0.8, bringToFront = T),
              popup = paste0("FIPS Code: ", cvl_blkgps$GEOID, "<br>",
                             "Tree Canopy: ", cvl_blkgps$tree_can)) %>%
  addLegend("bottomright", pal = pal, values = cvl_blkgps$tree_can,
            title = "Tree Canopy", opacity = 0.7)
m

Blocks

cvl_blocks <- read.csv("Cville_Tree/nlcd_tree_cville_blocks.csv")%>%
  as.data.frame()
head(cvl_blocks)
##   STATEFP10 COUNTYFP10 TRACTCE10 BLOCKCE10      GEOID10     NAME10  tree_can
## 1        51          3     10401      3025 5.100301e+14 Block 3025 74.666667
## 2        51          3     10401      3004 5.100301e+14 Block 3004  0.000000
## 3        51          3     10401      3005 5.100301e+14 Block 3005 25.907297
## 4        51          3     10401      3021 5.100301e+14 Block 3021 46.275294
## 5        51          3     10401      3016 5.100301e+14 Block 3016 44.680297
## 6        51          3     10401      3019 5.100301e+14 Block 3019  7.082353
cville_blocks$tree_can <- cvl_blocks$tree_can

pal <- colorNumeric("plasma", reverse = TRUE, domain = cvl_blocks$tree_can)
cvl_blocks$tree_can <- as.numeric(cvl_blocks$tree_can)
cville_blocks$COUNTYFP <- as.numeric(cville_blocks$COUNTYFP)
m <- leaflet()%>%
  addTiles()%>%
  addPolygons(data = cville_blocks,
              fillColor = ~pal(tree_can),
              weight = 1,
              opacity = 1,
              color = "white",
              fillOpacity = 0.6,
              highlight = highlightOptions(weight = 2, fillOpacity = 0.8, bringToFront = T),
              popup = paste0("FIPS Code: ", cvl_blocks$GEOID, "<br>",
                             "Tree Canopy: ", cvl_blocks$tree_can)) %>%
  addLegend("bottomright", pal = pal, values = cvl_blocks$tree_can,
            title = "Tree Canopy", opacity = 0.7)
m

Eastern Shore Region

east_tracts <- readRDS("Easternshore_Tree/eastshore_tracts.RDS")
east_blkgps <- readRDS("Easternshore_Tree/eastshore_blkgps.RDS")
east_blocks <- readRDS("Easternshore_Tree/eastshore_blocks.RDS")

Tracts

eastern_tracts <- read.csv("Easternshore_Tree/nlcd_tree_eastshore_tracts.csv")%>%
  as.data.frame()

head(eastern_tracts)
##   STATEFP COUNTYFP TRACTCE       GEOID NAME          NAMELSAD     tree_can
## 1      51        1   90200 51001090200  902  Census Tract 902 3.459906e+01
## 2      51        1  980200 51001980200 9802 Census Tract 9802 3.478487e+00
## 3      51        1  980100 51001980100 9801 Census Tract 9801 1.072296e+01
## 4      51        1   90400 51001090400  904  Census Tract 904 1.942142e+01
## 5      51      131  990100 51131990100 9901 Census Tract 9901 1.823426e-04
## 6      51      131  930300 51131930300 9303 Census Tract 9303 5.315767e+00
# cvl_tracts <- cvl_tracts[complete.cases(cvl_tracts),]

east_tracts$tree_can <- eastern_tracts$tree_can

pal <- colorNumeric("plasma", reverse = TRUE, domain = eastern_tracts$tree_can)
eastern_tracts$tree_can <- as.numeric(eastern_tracts$tree_can)
east_tracts$COUNTYFP <- as.numeric(east_tracts$COUNTYFP)
m <- leaflet()%>%
  addTiles()%>%
  addPolygons(data = east_tracts,
              fillColor = ~pal(tree_can),
              weight = 1,
              opacity = 1,
              color = "white",
              fillOpacity = 0.6,
              highlight = highlightOptions(weight = 2, fillOpacity = 0.8, bringToFront = T),
              popup = paste0("FIPS Code: ", eastern_tracts$GEOID, "<br>",
                             "Tree Canopy: ", eastern_tracts$tree_can)) %>%
  addLegend("bottomright", pal = pal, values = eastern_tracts$tree_can,
            title = "Tree Canopy", opacity = 0.7)
m

Blockgroups

eastern_blkgps <- read.csv("Easternshore_Tree/nlcd_tree_eastshore_blkgps.csv")%>%
  as.data.frame()

head(eastern_blkgps)
##   STATEFP COUNTYFP TRACTCE BLKGRPCE        GEOID      NAMELSAD    tree_can
## 1      51        1  990100        0 510019901000 Block Group 0  0.02928639
## 2      51        1   90800        2 510010908002 Block Group 2  9.97914084
## 3      51        1   90400        4 510010904004 Block Group 4 15.03623325
## 4      51        1   90400        3 510010904003 Block Group 3 18.64093784
## 5      51        1   90800        3 510010908003 Block Group 3 24.56083069
## 6      51        1   90300        1 510010903001 Block Group 1 13.84460076
# cvl_tracts <- cvl_tracts[complete.cases(cvl_tracts),]

east_blkgps$tree_can <- eastern_blkgps$tree_can

pal <- colorNumeric("plasma", reverse = TRUE, domain = eastern_blkgps$tree_can)
eastern_blkgps$tree_can <- as.numeric(eastern_blkgps$tree_can)
east_blkgps$COUNTYFP <- as.numeric(east_blkgps$COUNTYFP)
m <- leaflet()%>%
  addTiles()%>%
  addPolygons(data = east_blkgps,
              fillColor = ~pal(tree_can),
              weight = 1,
              opacity = 1,
              color = "white",
              fillOpacity = 0.6,
              highlight = highlightOptions(weight = 2, fillOpacity = 0.8, bringToFront = T),
              popup = paste0("FIPS Code: ", eastern_blkgps$GEOID, "<br>",
                             "Tree Canopy: ", eastern_blkgps$tree_can)) %>%
  addLegend("bottomright", pal = pal, values = eastern_blkgps$tree_can,
            title = "Tree Canopy", opacity = 0.7)
m

Blocks

eastern_blocks <- read.csv("Easternshore_Tree/nlcd_tree_eastshore_blocks.csv")%>%
  as.data.frame()

head(eastern_blocks)
##   STATEFP10 COUNTYFP10 TRACTCE10 BLOCKCE10      GEOID10     NAME10 tree_can
## 1        51          1     90600      4011 5.100109e+14 Block 4011 54.98551
## 2        51          1     90600      4023 5.100109e+14 Block 4023 45.93617
## 3        51          1     90700      1011 5.100109e+14 Block 1011 35.00000
## 4        51          1     90800      2078 5.100109e+14 Block 2078  0.00000
## 5        51          1     90800      2079 5.100109e+14 Block 2079  0.00000
## 6        51          1     90600      4048 5.100109e+14 Block 4048  0.00000
# cvl_tracts <- cvl_tracts[complete.cases(cvl_tracts),]

east_blocks$tree_can <- eastern_blocks$tree_can

pal <- colorNumeric("plasma", reverse = TRUE, domain = eastern_blocks$tree_can)
eastern_blocks$tree_can <- as.numeric(eastern_blocks$tree_can)
east_blocks$COUNTYFP <- as.numeric(east_blocks$COUNTYFP)
m <- leaflet()%>%
  addTiles()%>%
  addPolygons(data = east_blocks,
              fillColor = ~pal(tree_can),
              weight = 1,
              opacity = 1,
              color = "white",
              fillOpacity = 0.6,
              highlight = highlightOptions(weight = 2, fillOpacity = 0.8, bringToFront = T),
              popup = paste0("FIPS Code: ", eastern_blocks$GEOID, "<br>",
                             "Tree Canopy: ", eastern_blocks$tree_can)) %>%
  addLegend("bottomright", pal = pal, values = eastern_blocks$tree_can,
            title = "Tree Canopy", opacity = 0.7)
m